Ext.define('Extmx.form.WindowForm', {
    extend: 'Ext.window.Window',

    width: 420,
    height: 450,
    
    titleBtnGuarda:'Guardar',

    modal: true,
    draggable: false,
    layout:'fit',
    closeAction :'hide',
    resizable: false,

    initComponent: function (){

        Ext.apply( this,{

            //animateTarget : botonagregar.id,
            //html:'Ventana agregar',

            items:[{
                xtype: this.xtypeForm,
                listeners:{
                    scope: this,
                    agregado: function (formulario){
                        this.hide();
                    },
                    error: function (formulario,res,opts){

                    }
                }
            }],
            buttons:[{
                text: this.titleBtnGuarda,
                iconCls:'disk_download_floppy_save_icon',
                scope: this,
                handler: function (){//contexto del boton
                    var form= this.down('form');
                    console.info(form);
                    form.submit();
                }
            },{
                text:'Cancelar',
                scope: this,
                iconCls:'cancel_round_icon',
                handler: function (){
                    this.hide();
                }
            }]
        });
        
        this.callParent( arguments );
    }
});

